$(function () {
    $("#btnGenera").click(function(){
        generate();
    });
});
function generate(){
	var projectName = $("#projectName").val();
	if(projectName == ""){
		alert("projectName is require");
		return;
	}
	var groupName = $("#groupName").val();
	if(groupName == ""){
		alert("groupName is require");
		return;
	}
    var copyright = $("#copyright").val();
    if(copyright == ""){
        alert("copyright is require");
        return;
    }

    var author = $("#author").val();
    if(author == ""){
        alert("author is require");
        return;
    }

    var datasourceUrl = $("#datasourceUrl").val();
    if(datasourceUrl == ""){
        alert("数据库地址 is require");
        return;
    }
    var datasourcePort = $("#datasourcePort").val();
    if(datasourcePort == ""){
        alert("数据库端口 is require");
        return;
    }

    var datasourceUsername = $("#datasourceUsername").val();
    if(datasourceUsername == ""){
        alert("数据库用户名 is require");
        return;
    }
    var datasourceTable = $("#datasourceTable").val();
    if(datasourceTable == ""){
        alert("数据库名 is require");
        return;
    }

    var datasourcePwd = $("#datasourcePwd").val();
    if(datasourcePwd == ""){
        alert("数据库密码 is require");
        return;
    }
	window.open("/jeedcp-api/gen/ms?projectName="+ projectName + "&group=" + groupName+ "&copyright=" + copyright+
		"&author=" + author+ "&dbUrl=" + datasourceUrl+ "&dbPort=" + datasourcePort+ "&dbUsername=" + datasourceUsername+
		"&dbName=" + datasourceTable+ "&dbPassword=" + datasourcePwd);
}